<?php

namespace Controller\Dog;

class Detail extends Base {

	public function actionIndex() {
		$this->setCurrentMenuKey('Blind');
		$param = $this->getRouteParams();
		$userId = !empty($param[0]) ? (int) $param[0] : 0;
		if (!$userId) {
			$this->throwException('参数错误');
		}
		$userInfo = $this->getUserDetailInfo($userId);
		$userCondition = \Business\User::instance()->getUserConditionByUserId($userId);
		$userMasterInfo = \Business\User::instance()->getUserMasterInfoByUserId($userId);
		$photos = \Business\User::instance()->getUserPhotosByUserId($userId, 7);

		// 用户帖子
		$articlePager = new \Lib\Core\Pager();
		$articlePager->pageSize = 10;
		$articles = \Business\Article::instance()->findArticleByUserId($articlePager, $userId);
		$categoryInfoAndNumbers = \Business\Article::instance()->getHasArticleCategory($userId);

		// 其他狗狗
		$mbDogs = \Business\User::instance()->getUserLikeDog(7, $userInfo['City'], $userInfo['BreedId'], 0, $userId);
		$this->assign('mbDogs', $mbDogs);

		$this->assign('photos', $photos);
		$this->assign('userCondition', $userCondition);
		$this->assign('userMasterInfo', $userMasterInfo);
		$this->assign('categoryInfoAndNumbers', $categoryInfoAndNumbers);
		$this->assign('articlePager',$articlePager);
		$this->assign('articles',$articles);
		$this->display();
	}
}